public class hplog
{
    /*control function for the log,used for the initialization*/
    public native int set_local_log_path(String path);
    public native int set_local_log_size(int size);
    public native int set_log_init_level(int level);
    public native int set_log_process_name(String name);
    public native int set_log_flags(int flags);
    public native int init_java_hplog();
     
    /*public interface used in the running time*/
    public native int dyn_set_log_level(int i);
    public native int tx_log(int level,String msg);
    
    /*wrapper for the tx_log*/
    public int log_emgt(String msg)
    {
        return tx_log(EMGT,msg);
    }
    public int log_alet(String msg)
    {
        return tx_log(ALET,msg);
    }
    public int log_crit(String msg)
    {
        return tx_log(CRIT,msg);
    }
    public int log_eror(String msg)
    {
        return tx_log(EROR,msg);
    }
    public int log_warn(String msg)
    {
        return tx_log(WARN,msg);
    }
    public int log_notc(String msg)
    {
        return tx_log(NOTC,msg);
    }
    public int log_info(String msg)
    {
        return tx_log(INFO,msg);
    }
    public int log_debg(String msg)
    {
        return tx_log(DEBG,msg);
    }
    /*example for the usage of the java high version of performance log*/
    public static void main(String[] args)
    {
        /*construct the log infor*/
        hplog log = new hplog();
        log.set_local_log_path("/home/kevenzhu/project/hplog_proj/trunk/hplog_client/src/java/test.log");
        log.set_local_log_size(1024);
        log.set_log_init_level(DEBG);
        log.set_log_process_name("javalog");
        log.set_log_flags(log_local|log_remote);
        /*initialize the instance*/
        if(log.init_java_hplog()>0)
        {
            System.out.println("failed to initialize the daemon");
            return;
        }
        /*now we can use it*/
        log.tx_log(WARN,"this is a test "+1688+" from java");
        log.log_warn("another wrapper interface for the log");
    }

    static
    {
        System.loadLibrary("javahplog");
    } 
    /*log level*/
    final static int DEBG = 0;
    final static int INFO = 1;
    final static int NOTC = 2;
    final static int WARN = 3;
    final static int EROR = 4;
    final static int CRIT = 5;
    final static int ALET = 6;
    final static int EMGT = 7;
    /*log action control*/
    final static int log_local  = 1;
    final static int log_remote = 2;
    final static int log_monitor= 4;
}
